package com.pay.ioopos.support.serialport.custom;

/**
 * 外接串口支付实现
 * @author moyq5
 * @since 2022/7/28
 */
public class SerialPortPayerDefault implements SerialPortPayer {

    @Override
    public void cancel(CancelState state, String detail) {
        CustomSerialPortFactory.find(new SerialPortPayFinder() {
            @Override
            public void onFound(CustomSerialPort serialPort) {
                serialPort.setListener(SerialPortPayListener.getInstance());
                //serialPort.send(new SerialPortPayCmd2Cancel().serialize());
            }
        });
    }

    @Override
    public void pay(PayState state, String amount, String detail) {
        CustomSerialPortFactory.find(new SerialPortPayFinder() {
            @Override
            public void onFound(CustomSerialPort serialPort) {
                serialPort.setListener(SerialPortPayListener.getInstance());
                //serialPort.send(new SerialPortPayCmd2Cancel().serialize());
            }
        });
    }
}
